package br.com.medmark.bean;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;
import org.primefaces.util.MessageFactory;

public class BeanUtil {
	
	protected static Logger	logger	= Logger.getLogger(BeanGenerico.class.getName());
	
	private static void addMessage(FacesMessage message) {
		FacesContext.getCurrentInstance().addMessage(null, message);
		logger.info(message);
	}
	
	public static void addMessage(FacesMessage.Severity tipo, String nomeMensagem){
		FacesMessage message = MessageFactory.getMessage(nomeMensagem, tipo, new String[] {});
		addMessage(message);
	}
	
	/*
	public static void addMessage(FacesMessage message){
		message = MessageFactory.getMessage("login_usuario_login_senha_invalido", FacesMessage.SEVERITY_WARN , new String[] {});
		FacesContext.getCurrentInstance().addMessage(null, message);
		logger.info(message);
	}
	*/
}
